package com.hh.xxljobdemo2.jobhandler;

import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author hanhao
 * @description 定时任务demo
 * @date 2024/6/24
 */
@Component
public class JobDemo {

    @XxlJob("demo")
    public void runJobDemo() {
        LocalDateTime localDateTime = LocalDateTime.now();
        String nowTime = localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        XxlJobHelper.log("hello world!It is :" + nowTime);
    }
}